using System;
using System.ComponentModel.DataAnnotations;

namespace Blog.Core.Entities
{
    public class Article:Entity
    {
        public Article()
        {
           Date = DateTime.Now; 
        }

        [Required]
        public virtual string Title { get; set; }
        
        [Required]
        public virtual string Content { get; set; }
        
        public virtual DateTime Date { get; set; }

        public virtual string Categories { get; set; }

        public virtual int Views { get; set; }


        public virtual void SetCategories(string[] categories)
        {
            Categories = string.Join(",", categories);
        }

        public virtual string[] GetCategories()
        {
            return Categories.Split(',');
        }
    }
}